﻿using System;
using Microsoft.Xna.Framework;

namespace Syngine.Physics
{
	/// <summary>
	/// 
	/// </summary>
	public class PhysicsGameController : GameController
	{
		/// <summary>
		/// 
		/// </summary>
		/// <param name="game"></param>
		public PhysicsGameController(PhysicsGameBase game) : base(game)
		{
			PhysicsGame = game;
		}

		/// <summary>
		/// 
		/// </summary>
		public PhysicsGameBase PhysicsGame { get; private set; }

		public override void Initialize()
		{
			var game = PhysicsGame;
			WorldContext.Set(game.CreateWorld());
			base.Initialize();
		}

		public override void Update(GameTime gameTime)
		{
			WorldContext.Step((float)gameTime.ElapsedGameTime.TotalSeconds);
			base.Update(gameTime);
		}
	}
}
